<template>
	<!-- 顶部导航样式 和 返回操作按钮 -->
  <view class="custom-navbar">
    <view class="navbar-left">
     <!-- <uni-icons type="arrowleft" size="20" color="#333"></uni-icons>
      <text v-if="showText"><返回</text> -->
    </view>
    <view class="navbar-title">{{ title }}</view>
    <view class="navbar-right">
      <slot name="right"></slot>
    </view>
  </view>
</template>

<script setup>
const props = defineProps({
  title: String,
  showText: {
    type: Boolean,
    default: true
  }
});

const emit = defineEmits(['back']);

const handleBack = () => {
  if (getCurrentPages().length > 1) {
    uni.navigateBack();
  } else {
    emit('back'); // 自定义返回事件
  }
};
</script>

<style scoped>
.custom-navbar {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  background-color: #063e7d;
  /* 蓝色背景 */
  color: #f5f5f5;
  /* border-bottom: 1px solid #f5f5f5; */
}

.navbar-left {
  width: 80px;
  display: flex;
  align-items: center;
  font-size: 16px;
  cursor: pointer;
}

.navbar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}

.navbar-right {
  width: 80px;
  display: flex;
  justify-content: flex-end;
}
</style>